/*
 * ResourceAnalyzer.h
 *
 *  Created on: Nov 4, 2008
 *      Author: Ryan
 */

#ifndef RESOURCEANALYZER_H_
#define RESOURCEANALYZER_H_

#include "../../OOInterface/Objects/GameMap.h"
#include "../../OOInterface/Objects/Resource.h"
#include "../../OOInterface/Objects/Point3.h"

class ResourceAnalyzer
{
public:
	ResourceAnalyzer();
	virtual ~ResourceAnalyzer();

	const OOInterface::Point3f findIdealLocation( const OOInterface::GameMap& map, const OOInterface::Resource& r, float radius ) const;

private:
	OOInterface::Point3f findMaxLocation( const float* resources, unsigned int width, unsigned int height ) const;
	const float* computeMapResourceValues( const OOInterface::GameMap& map, const OOInterface::Resource& r, float radius ) const;
	float resourceAmountAt( const OOInterface::GameMap& map, const OOInterface::Resource& r, int locX, int locY, float radius ) const;
	inline int convertToIndex( unsigned int x, unsigned int y, unsigned int width ) const { return y * width + x; }
};

#endif /* RESOURCEANALYZER_H_ */
